<script>
  export default {
    globalData: {
      isIphoneX: false,
      hongwai: false,
      volume: 50,
      light: false
    },
    onLaunch: function() {
      this.init()
    },
    onShow: function() {
    },
    onHide: function() {
      console.log('App Hide')
    },
    methods: {
      init() {
        //用于适配iphonex及以上型号
        const iphoneCheckString = ['iphone x', 'iphone 12', 'iphone 13', 'iphone 14', 'huawei nova'];
        let context = this;
        uni.getSystemInfo({
          success: function(res) {
            const model = res.deviceModel.toLowerCase();
            const f = iphoneCheckString.some(item => {
              return model.indexOf(item) !== -1;
            })
            if (f) {
              context.globalData.isIphoneX = true;
            }

          },
          fail: function(err) {
            console.log('获取系统信息失败');
          }
        })


      },
    }
  }
</script>

<style>
  /*每个页面公共css */
</style>
